<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="文章名称" prop="articleName">
        <el-input
          v-model="queryParams.articleName"
          placeholder="请输入文章名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="文章标签" prop="articleTag">
        <el-input
          v-model="queryParams.articleTag"
          placeholder="请输入文章标签"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="文章状态" prop="articleState">
        <el-input
          v-model="queryParams.articleState"
          placeholder="请输入文章状态"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="作者名称" prop="managerName">
        <el-input
          v-model="queryParams.managerName"
          placeholder="请输入作者名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-input
          v-model="queryParams.createTime"
          placeholder="请输入创建时间"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['essay:article:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['essay:article:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['essay:article:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          :disabled="multiple"
          @click="handleArticleBq('top')"
          v-hasPermi="['essay:article:top']"
        >置顶</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          :disabled="multiple"
          @click="handleArticleBq('official')"
          v-hasPermi="['essay:article:official']"
        >官方</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          :disabled="multiple"
          @click="handleArticleBq('recommend')"
          v-hasPermi="['essay:article:recommend']"
        >推荐</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          :disabled="multiple"
          @click="handleArticleBq('boutique')"
          v-hasPermi="['essay:article:boutique']"
        >精品</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          :disabled="multiple"
          @click="handleArticleBq('good')"
          v-hasPermi="['essay:article:good']"
        >好文</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          :disabled="multiple"
          @click="handleArticleBq('topRecommend')"
          v-hasPermi="['essay:article:topRecommend']"
        >首页推荐</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['essay:article:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading"
              :data="articleList"
              @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="编号" align="center" prop="id" v-if="true"/>
      <el-table-column label="文章封面" align="center" prop="articleHeadPic">
        <template slot-scope="scope">
          <el-image
            style="width: 100px; height: 70px;"
            :src="scope.row.articleHeadPic"
            :preview-src-list="[scope.row.articleHeadPic]"/>
        </template>
      </el-table-column>>
      <el-table-column label="文章名称" align="center" prop="articleName" width="200"/>
      <el-table-column label="文章标签" align="center" prop="articleTag" width="200"></el-table-column>
      <el-table-column label="文章简介" align="center" prop="articleRemark" width="200" show-overflow-tooltip/>
      <el-table-column label="阅读量" align="center" prop="articleReadCount" />
      <el-table-column label="文章状态" align="center" prop="articleState">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.articleState" :value="scope.row.articleState"/>
        </template>
      </el-table-column>
      <el-table-column label="作者名称" align="center" prop="managerName" />
      <el-table-column label="文章内容" align="center" prop="articleContent" width="150">
        <template slot-scope="scope">
          <a style="color: #0f4be3;cursor:pointer;text-decoration:underline;" @click="showArticleContentInfo(scope.row)">
            {{ scope.row.articleContent.slice(0,10) }}
          </a>
        </template>
      </el-table-column>
      <el-table-column label="文章类型" align="center" prop="articleType" />
      <el-table-column label="点赞数" align="center" prop="articleStarNum" />
      <el-table-column label="评论数" align="center" prop="articleConNum" />
      <el-table-column label="首页推荐" align="center" prop="topRecommend">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.articleEnclosure" :value="scope.row.topRecommend"/>
        </template>
      </el-table-column>
      <el-table-column label="置顶" align="center" prop="top">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.articleYn" :value="scope.row.top"/>
        </template>
      </el-table-column>
      <el-table-column label="推荐" align="center" prop="recommend">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.articleYn" :value="scope.row.recommend"/>
        </template>
      </el-table-column>
      <el-table-column label="官方" align="center" prop="official">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.articleYn" :value="scope.row.official"/>
        </template>
      </el-table-column>
      <el-table-column label="精品" align="center" prop="boutique">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.articleYn" :value="scope.row.boutique"/>
        </template>
      </el-table-column>
      <el-table-column label="好文" align="center" prop="good">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.articleYn" :value="scope.row.good"/>
        </template>
      </el-table-column>
      <el-table-column label="附件" align="center" prop="enclosure" width="200" :show-overflow-tooltip='true'/>
      <el-table-column label="创建时间" align="center" prop="createTime">
        <template slot-scope="scope">
          <i v-if="scope.row.create_time" class="el-icon-time"></i>
          <span>{{ parseTime(scope.row.create_time, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="修改时间" align="center" prop="createTime">
        <template slot-scope="scope">
          <i v-if="scope.row.updateTime" class="el-icon-time"></i>
          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:article:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:article:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改文章信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row>
          <el-col :span="3">
            <span><strong>文章封面：</strong></span>
          </el-col>
          <el-col :span="5">
            <el-image
              style="width: 100px; height: 80px;"
              :src="form.articleHeadPic"
              :preview-src-list="[form.articleHeadPic]"/>
          </el-col>
          <el-col :span="16">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleImage"
            >上传图片</el-button>
            <el-input v-model="form.articleHeadPic" disabled style="margin-top: 14px"/>
          </el-col>
        </el-row>
        <el-form-item label="文章定义">
          <el-checkbox v-model="form.good" true-label="1" false-label="0">好文</el-checkbox>
          <el-checkbox v-model="form.recommend" true-label="1" false-label="0">推荐</el-checkbox>
          <el-checkbox v-model="form.official" true-label="1" false-label="0">官方</el-checkbox>
          <el-checkbox v-model="form.top" true-label="1" false-label="0" >置顶</el-checkbox>
          <el-checkbox v-model="form.boutique" true-label="1" false-label="0">精品</el-checkbox>
        </el-form-item>
        <el-form-item label="首页推荐" prop="topRecommend">
          <el-radio-group v-model="form.topRecommend">
            <el-radio
              v-for="dict in dict.type.articleEnclosure"
              :key="dict.value"
              :label="dict.value"
            >{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="是否公开" prop="disclosure">
          <el-switch
            v-model="form.disclosure"
            active-color="#13ce66"
            inactive-color="#CCCCCC">
          </el-switch>
        </el-form-item>
        <el-form-item label="文章名称" prop="articleName">
          <el-input v-model="form.articleName" placeholder="请输入文章名称"  maxlength="23"/>
        </el-form-item>
        <el-form-item label="文章标签" prop="articleTags">
          <el-tag
            :key="tag"
            v-for="tag in form.articleTags"
            closable
            :disable-transitions="false"
            @close="handleClose(tag)">
            {{tag}}
          </el-tag>
          <el-input
            class="input-new-tag"
            v-if="inputVisible"
            v-model="inputValue"
            ref="saveTagInput"
            size="small"
            @keyup.enter.native="handleInputConfirm"
            @blur="handleInputConfirm"
          >
          </el-input>
          <el-button v-else class="button-new-tag" size="small" @click="showInput">添加标签</el-button>
        </el-form-item>
        <el-form-item label="文章简介" prop="articleRemark">
          <el-input v-model="form.articleRemark" placeholder="请输入文章简介" maxlength="100"/>
        </el-form-item>
        <el-row>
<!--          <el-col :span="12">-->
<!--            <el-form-item label="文章状态" prop="articleState">-->
<!--              <el-select-->
<!--                v-model="form.articleState"-->
<!--                clearable-->
<!--                size="small"-->
<!--                style="width: 250px"-->
<!--                disabled-->
<!--              >-->
<!--                <el-option-->
<!--                  v-for="dict in dict.type.articleState"-->
<!--                  :key="dict.value"-->
<!--                  :label="dict.label"-->
<!--                  :value="dict.value"-->
<!--                />-->
<!--              </el-select>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
          <el-col :span="12">
            <el-form-item label="文章类型">
              <el-select
                v-model="form.articleType"
                placeholder="请选择文章类型"
                clearable
                size="small"
                style="width: 250px"
              >
                <el-option
                  v-for="dict in dict.type.articleType"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
<!--        <el-form-item label="作者名称" prop="managerName">-->
<!--          <el-input v-model="form.managerName" placeholder="请输入作者名称" />-->
<!--        </el-form-item>-->
        <el-form-item label="文章内容">
          <editor v-model="form.articleContent" :min-height="500"/>
        </el-form-item>
<!--        <el-form-item label="文章内容2">-->
<!--          <wang-editor ref="editor" v-model="form.articleContent" :isClear="isClear" @change="change"></wang-editor>-->
<!--        </el-form-item>-->
<!--        <el-row>
          <el-col :span="6">
            <el-form-item label="点赞数" prop="articleStarNum">
              <el-input v-model="form.articleStarNum"/>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="评论数" prop="articleConNum">
              <el-input v-model="form.articleConNum" disabled/>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="" prop="enclosure">
              <el-input v-model="form.enclosure"/>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="阅读量" prop="articleReadCount">
              <el-input v-model="form.articleReadCount" disabled/>
            </el-form-item>
          </el-col>
        </el-row>-->
        <el-row>
          <el-form-item label="视频源" prop="remark">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleFile"
            >上传视频</el-button>
            <el-input v-model="this.articleViedo" style="margin-top: 14px"/>
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label="备注" prop="remark">
            <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
          </el-form-item>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonCgLoading" type="info" @click="submitForm('1')">草稿不发布</el-button>
        <el-button :loading="buttonLoading" type="primary" @click="submitForm('0')">审核发布</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 查看消息详情对话框1 -->
    <my-article-content-info ref="myArticleContentInfo"></my-article-content-info>

    <!-- 添加或修改OSS对象存储对话框 -->
    <el-dialog :title="picTitle" :visible.sync="picOpen" width="500px" append-to-body :close-on-click-modal="false">
      <el-form ref="picForm" :model="picForm" :rules="picRules" label-width="80px">
        <el-form-item label="文件名">
          <imageUpload v-model="picForm.file" @input="getUploadFileList"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="picSubmitForm">确 定</el-button>
        <el-button @click="picCancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 上传文件，可以和上面的上传图片和为一体   -->
    <el-dialog :title="fileTitle" :visible.sync="fileOpen" width="500px" append-to-body :close-on-click-modal="false">
      <el-form ref="fileForm" :model="fileForm" :rules="fileRules" label-width="80px">
        <el-form-item label="文件名">
          <fileUpload v-model="fileForm.file" :fileSize="1024" @input="getUploadFileFiList"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonFileLoading" type="primary" @click="fileSubmitForm()">确 定</el-button>
        <el-button @click="fileCancel">取 消</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import { listArticle, getArticle, delArticle, addArticle, updateArticle,updateArticleSx } from "@/api/essay/article";
import myArticleContentInfo from './myArticleContentInfo'

export default {
  name: "Article",
  dicts: ['articleState','articleYn','articleEnclosure','articleType'],
  components: { myArticleContentInfo},
  data() {
    return {
      isClear: false,
      // 按钮loading
      buttonLoading: false,
      buttonCgLoading:false,
      buttonFileLoading:false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 文章信息表格数据
      articleList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 标签
      dynamicTags: [],
      inputVisible: false,
      inputValue: '',
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        articleHeadPic: undefined,
        articleName: undefined,
        articleRemark: undefined,
        articleReadCount: undefined,
        articleState: undefined,
        managerId: undefined,
        managerName: undefined,
        articleContent: undefined,
        createTime: undefined,
        articleType: undefined,
        articleStarNum: undefined,
        articleConNum: undefined,
        enclosure: undefined,
        recommend: undefined,
        official: undefined,
        boutique: undefined,
      },
      //图片
      picTitle:"",
      picOpen:false,
      picForm:{},
      uploadFileList: '',
      picRules:{
        file: [
          {required: true, message: "图片不能为空", trigger: "blur"}
        ]
      },
      //文件
      fileTitle:"",
      fileOpen:false,
      fileForm:{},
      uploadFileFiList: '',
      articleViedo: '',
      fileRules:{
        file: [
          {required: true, message: "文件不能为空", trigger: "blur"}
        ]
      },
      // 表单参数
      form: {
        articleTags:[]
      },
      // 表单校验
      rules: {
        articleHeadPic: [
          { required: true, message: "文章封面不能为空", trigger: "blur" }
        ],
        articleName: [
          { required: true, message: "文章名称不能为空", trigger: "blur" }
        ],
        articleRemark: [
          { required: true, message: "文章简介不能为空", trigger: "blur" }
        ],
        articleContent: [
          { required: true, message: "文章内容不能为空", trigger: "blur" }
        ],
        articleType: [
          { required: true, message: "文章类型不能为空", trigger: "change" }
        ]
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    change(val) {
      console.log(val)
    },
    /** 查询文章信息列表 */
    getList() {
      this.loading = true;
      listArticle(this.queryParams).then(response => {
        this.articleList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        articleHeadPic: undefined,
        articleName: undefined,
        articleTags: [],
        articleRemark: undefined,
        articleReadCount: undefined,
        articleState: undefined,
        managerId: undefined,
        managerName: undefined,
        articleContent: undefined,
        articleType: undefined,
        articleStarNum: undefined,
        articleConNum: undefined,
        enclosure: '',
        good: false,
        recommend: false,
        official: false,
        top: false,
        boutique: false,
        createTime: undefined,
        createBy: undefined,
        updateTime: undefined,
        updateBy: undefined,
        remark: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /**
     * 文章内容显示10个字
     */
    articleContentFormat(row, column, cellValue) {
      if (!cellValue) return ''
      if (cellValue.length > 10) {       //最长固定显示10个字符
        return cellValue.slice(0, 10) + '...'
      }
      return cellValue
    },
    /**
     * 查看文章详细
     */
    showArticleContentInfo(row){
      this.$refs.myArticleContentInfo.open = true
      this.$refs.myArticleContentInfo.articleName = row.articleName
      this.$refs.myArticleContentInfo.articleContent = row.articleContent
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加文章信息";
      this.reset();
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getArticle(id).then(response => {
        this.loading = false;
        this.form = response.data;
        if (this.form.disclosure === 'true'){
          this.form.disclosure = true
        }else {
          this.form.disclosure = false
        }
        this.open = true;
        this.title = "修改文章信息";
      });
    },
    /** 提交按钮 */
    submitForm(type) {
      this.$refs["form"].validate(valid => {
        if (valid) {
          //替换视频标签
          let reg = RegExp("<iframe","g");
          let reg2 = RegExp('</iframe>',"g");
          this.form.articleContent = this.form.articleContent.replace(reg, `<video width=100% height="430px" controls="controls" `).replace(reg2, '</video>')
          // this.form.articleContent = this.form.articleContent.replace('<iframe', `<video width=100% height="auto" controls="controls" `).replace('/</iframe>/g', '</video>')
          if (this.form.good === false){
            this.form.good = '0'
          }
          if (this.form.recommend === false){
            this.form.recommend = '0'
          }
          if (this.form.official === false){
            this.form.official = '0'
          }
          if (this.form.top === false){
            this.form.top = '0'
          }
          if (this.form.boutique === false){
            this.form.boutique = '0'
          }
          if (this.form.id != null) {
            //1表示未审核
            if (type === '1'){
              this.buttonCgLoading = true
              this.form.articleState = '1'
            }else{
              this.buttonLoading = true;
              this.form.articleState = '0'
            }
            updateArticle(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonCgLoading = false
              this.buttonLoading = false;
            });
          } else {
            this.form.managerId = this.$store.getters.userid;
            this.form.managerName = this.$store.getters.nickname;
            //1表示未审核
            if (type === '1'){
              this.form.articleState = '1'
            }else{
              this.form.articleState = '0'
            }
            addArticle(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 更改文章属性*/
    handleArticleBq(bs){
      const ids = this.ids;
      this.$modal.confirm('是否确认修改文章信息编号为"' + ids + '"的数据项？').then(() => {
        this.loading = true;
        return updateArticleSx(ids,bs);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("修改成功");
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除文章信息编号为"' + ids + '"的数据项？').then(() => {
        this.loading = true;
        return delArticle(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/article/export', {
        ...this.queryParams
      }, `article_${new Date().getTime()}.xlsx`)
    },
    /** 上传图片 */
    handleImage(){
      this.picOpen = true;
      this.picTitle = "上传图片";
    },
    getUploadFileList(data) {
      this.uploadFileList = data
    },
    picSubmitForm(){
      this.$refs["picForm"].validate(valid => {
        if (valid) {
          this.buttonLoading = true
          this.form.articleHeadPic = this.uploadFileList
          this.buttonLoading = false
          this.picOpen = false
        }
      });

    },
    // 取消按钮
    picCancel() {
      this.picOpen = false;
      this.picForm = {
        file: undefined
      };
      this.uploadFileList = ''
      this.resetForm("picForm");
    },
    /** 上传文件**/
    handleFile(){
      this.fileOpen = true;
      this.fileTitle = "上传视频";
    },
    getUploadFileFiList(data) {
      this.uploadFileFiList = data
    },
    fileSubmitForm(){
      this.$refs["fileForm"].validate(valid => {
        if (valid) {
          this.buttonFileLoading = true
          this.articleViedo = this.uploadFileFiList
          this.buttonFileLoading = false
          this.fileOpen = false
        }
      });

    },
    // 取消按钮
    fileCancel() {
      this.fileOpen = false;
      this.fileForm = {
        file: undefined
      };
      this.uploadFileFiList = ''
      this.resetForm("fileForm");
    },
    /**
     * 标签
     * @param tag
     */
    handleClose(tag) {
      this.form.articleTags.splice( this.form.articleTags.indexOf(tag), 1);
      // this.form.articleTag = this.form.articleTag.concat(this.dynamicTags)
    },
    showInput() {
      this.inputVisible = true;
      this.$nextTick(_ => {
        this.$refs.saveTagInput.$refs.input.focus();
      });
    },
    handleInputConfirm() {
      this.dynamicTags = []
      let inputValue = this.inputValue;
      if (inputValue) {
        this.dynamicTags.push(inputValue);
        this.form.articleTags = this.form.articleTags.concat(this.dynamicTags)
      }
      this.inputVisible = false;
      this.inputValue = '';
    }
  }
};
</script>
<style lang="scss" scoped>
.el-tag + .el-tag {
  margin-left: 10px;
}
.button-new-tag {
  margin-left: 10px;
  height: 32px;
  line-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}
.input-new-tag {
  width: 90px;
  margin-left: 10px;
  vertical-align: bottom;
}
</style>
